#!/usr/bin/perl

# Create List of URLS From Free For All Link Page
# Created by Matt Wright on 12/15/95
# Version 1.0	Last Modified: 12/15/95
# Usage: make_list.pl <infile> <outfile>

$num = @ARGV;

if ($num == 2) {
   ($infile,$outfile) = @ARGV;
}
else {
   print "Wrong Number of Arguments!\n\n";
   print "USAGE:\n";
   print "make_list.pl <infile> <outfile>\n";
   print "\n";
   exit;
}

if (-e $infile) {
   open(LINKS,$infile);
   @lines = <LINKS>;
   close(LINKS);
}
else {
   print "No Such File: $infile!\n";
   print "\n";
   exit;
}

foreach $line (@lines) {
   chop($line);
   if ($line =~ /<a href=\"(.*)\">.*<\/a>/) {
      $cur_url = $1;
      if ($1 =~ /^http:\/\//) {
         push(@URLS,$cur_url);
         $urls++;
      }
   }
}

open(DATA,">$outfile");
foreach $url (@URLS) {
   print DATA "$url\n";
}
close(DATA);

print "$urls URLs Added To $outfile!\n\n";
